package com.yc.system.controller;

import java.util.List;

import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import  com.yc.system.service.IBookTypeService;


import com.yc.framework.baseClass.BaseController;
//import com.yc.framework.baseClass.ServiceFacade;
import com.yc.framework.baseClass.R;
import com.yc.system.entity.BookType;
/**
 * <p>
    * 图书分类 前端控制器
    * </p>
 *
 * @author 1850140986@qq.com
 * @since 2022-12-03
 */
@RestController
//@RequestMapping("/sys/bookType")
public class BookTypeController extends BaseController
    {

    @Autowired
        //private IBookTypeService t_book_typeService;
  private IBookTypeService service;

  /**
   * 根据条件分页查询BookType
   * @param model 实体对象
   * @return 查询列表
   */
     @PostMapping("/sys/bookType/list")
    public R list(@RequestBody BookType model){
        return service.list(model);

    }

    /**
    * 根据主键查询单个对象
    * @param model 实体对象包含uuid
    * @return 成功或失败
    */
    @GetMapping("/sys/bookType/getById/{id}")
    public R getById(@PathVariable String id) {
        return service.getModelById(id);
    }

		@PostMapping("/index/sys/bookTypeInfo/getById")
		public R getTypeNameById(@RequestParam String id) {
			return service.getinfoById(id);
		}
    /**
	 * 新增实体对象
	 *
     * @param model 实体对象
	 * @return 新增是否成功
	 */
     @PostMapping("/sys/bookType/save")
	public R save(@RequestBody BookType model) {
		return service.saveModel(model);

	}

    /**
	 * 批量新增实体对象
	 *
     * @param modelList 实体对象列表
	 * @return 新增是否成功
	 */
	@PostMapping("/sys/bookType/saveBatch")
	public R saveBatch(@RequestBody List<BookType> modelList) {
		return service.saveModelBatch(modelList);

	}

    /**
	 * 根据主键删除实体
	 *
     * @param uuid 实体携带主键
	 * @return 删除是否成功
	 */
	@DeleteMapping("/sys/bookType/removeById/{id}")
	public R removeById(@PathVariable String id) {
		return service.removeModelById(id);
	}

     /**
	 * 根据主键列表删除实体
	 *
     * @param idList 实体主键
	 * @return 删除是否成功

	@DeleteMapping("/removeByIdList")
	public R removeByIdList(@RequestBody List<BookType> idList) {
        return service.removeModelByIdList(idList);

    }
 */
    /**
    * 根据主键修改实体
    *
    * @param model 等待修改的对象
    * @return 修改是否成功
    */
    @PutMapping("/sys/bookType/updateById")
    public R updateModelById(@RequestBody BookType model) {
        return service.updateModelById(model);

    }

    /**
    * 根据主键列表修改实体列表
    *
    * @param modelList 等待修改的对象列表
    * @return 修改是否成功
    */
    @PostMapping("/sys/bookType/updateByIdBatch")
    public R updateModelByIdBatch(@RequestBody List<BookType> modelList) {
        return service.updateModelByIdBatch(modelList);

    }

      /**
	 * 根据多主键列表删除实体
	 *
     * @param idList 多主键
	 * @return 删除是否成功
	 */
	@DeleteMapping("/sys/bookType/removeByIds/{ids}")
	public R removeByIdList(@PathVariable String ids) {
        return service.removeModelByIds(ids);

    }

    @GetMapping("index/sys/bookType/getAllBookType")
		public R getAllBookType(){
		return service.getAllBookType();
	}

}
